<template>
  <div class="rightBox">
    <el-table :data="rightData" border style="width:500px;">
      <el-table-column type=index label="#" width="50" />
      <el-table-column prop="authName" label="权限名称" width="150" />
      <el-table-column prop="path" label="权限路径" width="150" />
      <el-table-column label="权限级别" width="150">
      <template #default="{ row }">
        {{ row.level === '0' ? '一' : (row.level === '1' ? '二' : '三') }}级权限
      </template>
    </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: 'oaRights',
  data () {
    return {
      rightData: []
    }
  },
  methods: {
    async getRightList () {
      const rightsRes = await this.$http('rights/list')
      if (rightsRes.meta?.status !== 200) return
      this.rightData = rightsRes.data
      console.log(rightsRes)
    }
  },
  created () {
    this.getRightList()
  }
}
</script>
